package com.zhoutao.blog.seven.dao.repository;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhoutao.blog.seven.dao.mapper.SettingMapper;
import com.zhoutao.blog.seven.dao.model.SettingDao;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.List;

@Slf4j
@Service
public class SettingRepository extends ServiceImpl<SettingMapper, SettingDao> {


    /**
     * 查询配置项
     *
     * @param keys
     * @return
     */
    public List<SettingDao> listByKey(List<String> keys) {
        LambdaQueryWrapper<SettingDao> wrapper = new LambdaQueryWrapper<>();
        wrapper.in(!CollectionUtils.isEmpty(keys), SettingDao::getKeyName, keys);
        return list(wrapper);
    }
}
